import turtle as tu

tu.pensize(30)
def num(len_list,len1,list):
    list_new=list
    if len_list>len1:
        return list
    else:
        len_temp=len1 - len_list
        if len_temp<len_list:
            pass
        else:
            len_times=len_temp//len_list
            list_new=list*(len_times+1)
            len_temp=len_temp-len_times*len_list

        for i in range(len_temp):
            list_new.append(list[i])
            print(list[i])
        print(list_new)
        return list_new

def drawSnake(rad,angle,len1,neckrad):
    list = ['red', 'cyan', 'blue', 'yellow', 'orange', 'green', 'purple']
    len_list = len(list)
    list = num(len_list, len1, list)
    for i in range(len1):
        tu.pencolor(list[i])
        tu.circle(rad,angle)
        tu.circle(-rad,angle)
   #最后一个圆
    tu.pencolor("green")
    tu.circle(rad,angle/2)
    tu.fd(rad)
    tu.circle(neckrad+1,180)
    tu.fd(rad*2/3)
def main():
    tu.setup(1300,800,0,0)
    pythonsize=45
    # tu.pensize=(pythonsize)
    tu.penup()
    tu.back(400)
    tu.pendown()
    tu.seth(-40)
    drawSnake(40,80,7,pythonsize/2)
main()
tu.done()
